package com.xbts.system.domain;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xbts.common.core.annotation.Excel;
import com.xbts.common.core.utils.StringUtils;
import com.xbts.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 监控排序对象 sys_monitor_sort
 * 
 * @author xbts
 * @date 2023-12-22
 */
@Data
@ApiModel(value = "SysMonitorSort", description = "监控排序对象")
public class SysMonitorSort extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** id */
    @ApiModelProperty("id")
    private String id;

    /** 1为首页排续，2为二级页面排续 */
    @Excel(name = "1为首页排续，2为二级页面排续")
    @ApiModelProperty("1为首页排序，2为二级页面排序")
    private Integer type;

    /** 监控唯一标识 */
    @Excel(name = "监控唯一标识")
    @ApiModelProperty("监控唯一标识")
    private String monitorId;

    /** 排序 */
    @Excel(name = "排序")
    @ApiModelProperty("排序")
    private Integer sort;

    public <T> QueryWrapper<T> queryWrapper() {
        QueryWrapper<T> wrapper=new QueryWrapper<>();

        wrapper.like(StringUtils.isNotEmpty(id),"id" , id);
        wrapper.eq(type != null,"type" , type);
        wrapper.like(StringUtils.isNotEmpty(monitorId),"monitor_id" , monitorId);
        wrapper.eq(sort != null,"sort" , sort);
        wrapper.orderByAsc("sort");
        wrapper.orderByDesc("create_time");
        return wrapper;
    }

}
